home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / tsetguid.zip / TEA / SET / SAMPLE / CAPTIONB.JAV < prev    next >
Text File  |  1997-02-27  |  2KB  |  75 lines

  1. /*
  2.  * Copyright (c) 1996-1997, InetSoft Technology Corp, All Rights Reserved.
  3.  *
  4.  * The software and information contained herein are copyrighted and 
  5.  * proprietary to InetSoft Technology Corp. This software is furnished 
  6.  * pursuant to a written license agreement and may be used, copied, 
  7.  * transmitted, and stored only in accordance with the terms of such 
  8.  * license and with the inclusion of the above copyright notice. Please 
  9.  * refer to the file "COPYRIGHT" for further copyright and licensing 
  10.  * information. This software and information or any other copies 
  11.  * thereof may not be provided or otherwise made available to any 
  12.  * other person. 
  13.  */
  14. package tea.set.sample;
  15.  
  16. import java.applet.*;
  17. import java.awt.*;
  18. import java.awt.event.*;
  19. import tea.set.*;
  20.  
  21. /**
  22.  * This is a demo applet to show using tea.set.Effect3D to build a
  23.  * captioned box.
  24.  *
  25.  * @see Effect3D
  26.  * @version 1.3, 01/31/97
  27.  * @author InetSoft Technology Corp
  28.  */
  29. public class CaptionBox extends Applet {
  30.    public void init() {
  31.       setLayout(new BorderLayout());
  32.  
  33.       // setup option panel
  34.       Panel pnl = new Panel();
  35.       pnl.setLayout(new GridLayout(4, 1));
  36.       CheckboxGroup cg = new CheckboxGroup();
  37.       Checkbox cb;      
  38.       ItemListener il = new ItemListener() {
  39.      public void itemStateChanged(ItemEvent e) {
  40.         Checkbox cbox = (Checkbox) e.getSource();
  41.         if(cbox.getState()) {
  42.            if(cbox.getLabel().equals("Raised Border")) {
  43.           box.setStyle(Effect3D.RAISED_BORDER);
  44.            }
  45.            else if(cbox.getLabel().equals("Lowered Border")) {
  46.           box.setStyle(Effect3D.LOWERED_BORDER);
  47.            }
  48.            else if(cbox.getLabel().equals("Raised Surface")) {
  49.           box.setStyle(Effect3D.RAISED);
  50.            }
  51.            else if(cbox.getLabel().equals("Lowered Surface")) {
  52.           box.setStyle(Effect3D.LOWERED);
  53.            }
  54.         }
  55.      }
  56.       };
  57.       
  58.       pnl.add(cb = new Checkbox("Raised Border", cg, true));
  59.       cb.addItemListener(il);
  60.       pnl.add(cb = new Checkbox("Lowered Border", cg, false));
  61.       cb.addItemListener(il);
  62.       pnl.add(cb = new Checkbox("Raised Surface", cg, false));
  63.       cb.addItemListener(il);
  64.       pnl.add(cb = new Checkbox("Lowered Surface", cg, false));
  65.       cb.addItemListener(il);
  66.       
  67.       // add 3D box to the panel
  68.       add("Center", box = new Effect3D(pnl, "Option Box", 
  69.                        Effect3D.RAISED_BORDER));
  70.    }
  71.    
  72.    private Effect3D box;
  73. }
  74.  
  75.